package red.cola.auth.controller;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import red.cola.result.Result;

import java.util.HashMap;
import java.util.Map;

/**
 * @Name: IndexController
 * @Author: Cola
 * @Time: 2023/3/6 16:03
 * @Description: IndexController
 */
@Api(tags = "后台登录管理")
@RestController
@RequestMapping("/admin/system/index")
public class IndexController {


    /**
     * 登录
     *
     * @return Result.ok
     */
    @PostMapping("login")
    public Result login() {
        Map<String, Object> map = new HashMap<>();
        map.put("token", "admin");
        return Result.ok(map);
    }

    /**
     * 获取用户信息
     *
     * @return Result.ok
     */
    @GetMapping("info")
    public Result info() {
        Map<String, Object> map = new HashMap<>();
        map.put("roles", "[admin]");
        map.put("name", "admin");
        map.put("avatar", "https://cola-picgo-1311841992.cos.ap-beijing.myqcloud.com/myDoc2023_logo_dark.svg");
        return Result.ok(map);
    }

    /**
     * 退出
     *
     * @return Result.ok
     */
    @PostMapping("logout")
    public Result logout() {
        return Result.ok();
    }

}
